import { Button, message } from 'antd';
import React, { Component, Fragment } from 'react';
class Test extends Component {
  constructor(props) {
    super(props);
    this.state = {
      myInput: ''
    };
  }
  getRefsData() {
    message.info('ref数据:' + this.state.myInput.value);
    console.log(this.state.myInput.value);
  }
  render() {
    return (
      <Fragment>
        <input ref={el => (this.state.myInput = el)}></input>
        <Button onClick={this.getRefsData.bind(this)}>获取ref数据</Button>
        <Button onClick={() => this.getRefsData()}>获取ref数据111</Button>
      </Fragment>
    );
  }
}

export default Test;
// this.myRef = React.createRef();
// <input ref={this.myRef}></input>
//     console.log(this.myRef.current.value);
